<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--#include file="DataLoad.asp"-->

<html>
<head>
<title><%=GuildName%> - DKP系统</title>
<script language="JavaScript" src="inc/jquery.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="Generator" content="EditPlus">
<meta name="Author" content="SULei">
<meta name="Keywords" content="FSDKP DKP WOW GUILD RAID">
<meta name="Description" content="">
<link href="<%=StylePath%>/main.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" src="<%=StylePath%>/styleplus.js"></script>
<style type="text/css" media="all">

</style>
</head>

<body>
<div class="header">
<!--#include file="menu.asp"-->
</div>
<div class="main">
	<%
	Dim XMLdata , JoinXML , LeaveXML , LootXML , EventXML , ExtraXML
	Call ExportXML()
	%>
	复制以下内容保存为.XML文件
	<textarea name="" rows=35" cols="160"><%=XMLdata%></textarea>
</div>
<div id="footer"><!--#include file="footer.asp"--></div>
</body>
</html>
<%
Sub ExportXML()
	'Baseinfo
	if not IsNumeric(request("id")) then exit sub

	Dim StratTime , RaidTitle , arrPlayer , Rid
	Rid=request("id")
	sql="select top 1 * from raid where id="&Rid
	rs.open sql,conn,1,1
		StartTime=rs("Raid_actionTime")
		EndTime=rs("raid_endtime")
		RaidTitle=rs("Raid_Name")
		arrPlayer=split(rs("Raid_player"),", ")

	'ExtraXML
		ExtraXML=ExtraXML&"<Extra><Endtime>"&EndTime&"</Endtime><DKPrule>"&rs("raid_ruler")&"</DKPrule><DKPclass>"&rs("raid_class")&"</DKPclass><DKPverify></DKPverify></Extra>"

	rs.close

	'JoinInfo
	for i = 0 to Ubound(arrPlayer)
		sql="select top 1 id,player_name,player_tribe,player_profession from player where id="&arrPlayer(i)
		rs.open sql,conn,1,1
		JoinXML=JoinXML&"<key"&i+1&"><player>"&rs("player_name")&"</player><race>"&rs("player_tribe")&"</race><class>"&rs("player_profession")&"</class><level>60</level><time>"&CheckJoin(rs("id"),Rid,StartTime)&"</time></key"&i+1&">"&vbCrlf
		rs.close
	next
	JoinXML="<Join>"&vbCrlf&JoinXML&"</Join>"&vbCrlf

	'LeaveInfo
	sql="select * from raid_event where event_class='离开' and event_raidid="&Rid
	rs.open sql,conn,1,1
		if not (rs.bof or rs.eof) then
			for i = 1 to rs.recordcount
				LeaveXML=LeaveXML&"<key"&i&"><player>"&id2name2(rs("event_object"))&"</player><time>"&rs("event_time")&"</time></key"&i&">"&vbCrlf
			rs.movenext
			next
		end if
	rs.close
	LeaveXML="<Leave>"&vbCrlf&LeaveXML&"</Leave>"&vbCrlf

	'LootInfo & EventInfo
	sql="select * from raid_event where event_raidid="&Rid&" order by event_time"
	rs.open sql,conn,1,1
		dim ia,ib
		ia=1
		ib=1
			for i = 1 to rs.recordcount
				Select Case rs("event_class")
					Case "拾取"
						LootXML=LootXML&"<key"&ia&"><ItemName>"&rs("event_object2")&"</ItemName><ItemID>00000:0:0:0</ItemID><Color>ffa335ee</Color><Count>1</Count><Player>"&id2name2(rs("event_object"))&"</Player><Time>"&rs("event_time")&"</Time><Note>"&rs("event_dkp")&"</Note></key"&ia&">"&vbCrlf
						ia=ia+1
					Case "分解"
						LootXML=LootXML&"<key"&ia&"><ItemName>"&rs("event_object2")&"</ItemName><ItemID>00000:0:0:0</ItemID><Color>ffa335ee</Color><Count>1</Count><Player>"&id2name2(rs("event_object"))&"</Player><Time>"&rs("event_time")&"</Time><Note>ENC</Note></key"&ia&">"&vbCrlf
						ia=ia+1
					Case "仓库"
						LootXML=LootXML&"<key"&ia&"><ItemName>"&rs("event_object2")&"</ItemName><ItemID>00000:0:0:0</ItemID><Color>ffa335ee</Color><Count>1</Count><Player>"&id2name2(rs("event_object"))&"</Player><Time>"&rs("event_time")&"</Time><Note>BOE</Note></key"&ia&">"&vbCrlf
						ia=ia+1
					Case "首次"
						EventXML=EventXML&"<key"&ib&"><EventClass>首次</EventClass><Player>"&id2name2(rs("event_object"))&"</Player><Event>"&rs("event_object2")&"</Event><Time>"&rs("event_time")&"</Time></key"&ib&">"&vbCrlf
						ib=ib+1
					Case "发现"
						EventXML=EventXML&"<key"&ib&"><EventClass>发现</EventClass><Player>"&id2name2(rs("event_object"))&"</Player><Event>"&rs("event_object2")&"</Event><Time>"&rs("event_time")&"</Time></key"&ib&">"&vbCrlf
						ib=ib+1
					Case "收割"
						EventXML=EventXML&"<key"&ib&"><EventClass>收割</EventClass><Player>"&id2name2(rs("event_object"))&"</Player><Event>"&rs("event_object2")&"</Event><Time>"&rs("event_time")&"</Time></key"&ib&">"&vbCrlf
						ib=ib+1
				End Select
			rs.movenext
			next
	rs.close
		LootXML="<Loot>"&vbCrlf&LootXML&"</Loot>"&vbCrlf
		if EventXML<>"" then EventXML="<Event>"&vbCrlf&EventXML&"</Event>"&vbCrlf






	'Export
	sql="select"
	XMLdata=XMLdata& "<?xml version=""1.0"" encoding=""gb2312""?>"&vbCrlf
	XMLdata=XMLdata& "<RaidInfo>"&vbCrlf&"<key>"&StartTime&"</key><note>"&RaidTitle&"</note>"&vbCrlf&JoinXML&LeaveXML&LootXML&EventXML&ExtraXML&vbCrlf&"</RaidInfo>"
End Sub


Function CheckJoin(id,rid,Default)
	sql="select top 1 * from raid_event where event_object='"&id&"' and event_class='加入' and event_raidid="&rid
	rs2.open sql,conn,1,1
		if rs2.eof or rs2.bof then
			CheckJoin=Default
		else
			CheckJoin=rs2("event_time")
		end if
	rs2.close
End Function
%>


	
	
		
